<?php
if ( Yii::app()->user->isGuest ) {
    echo "u Hacker ? but u can login plz...";
} else {
    $userInfo = Yii::app()->user->getState("userInfo");
    $user_type = "normal";
    if ( $userInfo['membership'] == "1" ) {
        $user_type = "premium";
    }

    ?>
<style>
    #account_info,#character_info {
        margin-left: 14px;
        border: 1px solid gray;
    }
    #Dashboard {
        margin-bottom: 10px;
    }
    #account_head,#character_head {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 14px;
        color: white;
        padding: 4px 10px;
        background: -moz-linear-gradient( top, dimGray 0%, black);
        background: -webkit-gradient( linear, left top, left bottom, from(dimGray), to(black));
        -moz-border-radius: 30px;
        border: 1px solid black;
        -moz-box-shadow: 0px 1px 3px rgba(000,000,000,0.5), inset 0px 0px 1px rgba(255,255,255,0.7);
        -webkit-box-shadow: 0px 1px 3px rgba(000, 000, 000, 0.5), inset 0px 0px 1px rgba(255, 255, 255, 0.7);
        box-shadow: 0px 1px 3px rgba(000, 000, 000, 0.5), inset 0px 0px 1px rgba(255, 255, 255, 0.7);
        text-shadow: 0px -1px 0px rgba(000, 000, 000, 0.4), 0px 1px 0px rgba(255, 255, 255, 0.3);
        cursor: default;
    }
    .act_box {
        display: inline-block;
        width: 250px;
    }
    .act_box div label {
        font-weight: bolder;
        display: inline-block;
        width: 100px;
        text-align: right;
        padding: 4px;
        background-color: #E8EDED;
        border-bottom: 1px solid white;
    }
    .act_box div:first-child {
        margin-top: 2px;
    }
    .act_box div div {
        display: inline;
    }
</style>
<div id="Dashboard" class="box_right_head">Member Dashboard</div>
<div id="account_info">
    <div id="account_head">Account Info</div>
    <div class="act_box">
        <div><label>Id : </label><div> <?php echo $userInfo['id']; ?></div></div>
        <div><label>Name </label><div> <?php echo $userInfo['name']; ?></div></div>
        <div><label>Email </label><div> <?php echo $userInfo['email']; ?></div></div>
    </div>
    <div class="act_box">
        <div><label>IP</label><div> <?php echo $userInfo['last_ip']; ?></div></div>
        <div><label>Type</label><div> <?php echo $user_type; ?></div></div>
        <div><label>Point</label><div> <?php echo $userInfo['credits']; ?></div></div>
    </div>
</div>
<div style="margin-bottom: 10px;"></div>
<div id="character_info">
    <div id="character_head">Character Info</div>

    <table class="table2" style="margin-bottom: 0px;">
        <thead>
        <tr>
            <th scope="col" >Name</th>
            <th scope="col" >Class</th>
            <th scope="col" >Race</th>
            <th scope="col" >Gender</th>
            <th scope="col">Status</th>
        </tr>
        </thead>
        <tbody>

            <?php

            foreach (CJSON::decode($player) as $key => $value) {
                if ( $value['online'] == 0 ) {
                    $online = "offline";
                } else {
                    $online = "online";
                }
                echo <<<HTML
                       <tr>
                       <td>{$value['name']}</td>
                       <td>{$value['player_class']}</td>
                       <td>{$value['race']}</td>
                       <td>{$value['gender']}</td>
                       <td>{$online}</td>
                       </tr>
HTML;

            }
            ?>

        </tbody>
    </table>

    <style>

        .table2 thead th, .table2 tfoot td{
            padding: 6px 10px 8px 10px;
            color: white;
            font-size: 14px;
            background-color: #222;
            font-weight: normal;
            border-right: 1px dotted #666;
            -moz-box-shadow: 0px -1px 4px #000;
            -webkit-box-shadow: 0px -1px 4px black;
            box-shadow: 0px -1px 4px black;
            text-shadow: 0px 0px 1px white;
            text-shadow: 1px 1px 1px black;
        }

        .table2 thead th:empty{
            background:transparent;
            -moz-box-shadow:none;
            -webkit-box-shadow:none;
            box-shadow:none;
        }
        .table2 thead :nth-last-child(1){
            border-right:none;
        }

        .table2 tbody :nth-last-child(1){
            border:none;
        }
        .table2 tbody th{
            text-align:right;
            padding:10px;
            color:#333;
            text-shadow:1px 1px 1px #ccc;
            background-color:#f9f9f9;
        }
        .table2 tbody td{
            padding:10px;
            background-color:#f0f0f0;
            border-right:1px dotted #999;
            text-shadow:-1px 1px 1px #fff;
            text-transform:uppercase;
            color:#333;
        }
    </style>

</div>
<?php } ?>